﻿using System.Web.Mvc;
using Citi.Scheduler.Domain;
using Citi.Scheduler.WebUi.Models;

namespace Citi.Scheduler.WebUi.Controllers
{
    public class RoutineErrorController : ControllerBase<RoutineErrorModel, RoutineError>
    {
        [ValidateInput(false)]
        public ActionResult ByRoutineExecution(int routineExecutionId)
        {
            var models = new RoutineErrorModel().CreateModel( new RoutineError().GetErrorsByRoutineExecution(routineExecutionId));
            return PartialView(models);
        }

        public ActionResult ErrorDetails(int id)
        {
            var model = new RoutineErrorModel().CreateModel(new RoutineError().SelectById<RoutineError>(id));

            return PartialView(model);
        }

        public ActionResult ErrorEmail(int routineExecutionId)
        {
            var model = new RoutineExecutionModel().CreateModel(new RoutineExecution().SelectById<RoutineExecution>(routineExecutionId));
            return View(model);
        }
    }
}
